package com.edison.demo.until;

import java.util.Random;

/** random generate doc number
 * @author edison
 */
public class DocumentNumberGenerator {

    private DocumentNumberGenerator(){
        throw new IllegalStateException("Utility class");
    }
    private static final Random RANDOM = new Random();

    public static String generateDocumentNumber() {
        StringBuilder docNumber = new StringBuilder("914");

        // Generate the next 5 digits
        for (int i = 0; i < 5; i++) {
            docNumber.append(RANDOM.nextInt(10));
        }

        // Append "MA" which appears frequently in the pattern
        docNumber.append("MA");

        // Generate the next 10 characters (can be digits or uppercase letters)
        for (int i = 0; i < 10; i++) {
            if (RANDOM.nextBoolean()) {
                // Append a digit
                docNumber.append(RANDOM.nextInt(10));
            } else {
                // Append a random uppercase letter
                docNumber.append((char) ('A' + RANDOM.nextInt(26)));
            }
        }

        return docNumber.toString();
    }


}
